<!DOCTYPE html>
<html lang="en">
<head>
     <meta charset="UTF-8">
     <meta http-equiv="X-UA-Compatible" content="IE=edge">
      <meta name="viewport" content="width=device-width, initial-scale=1.0">
      <title>Document</title>
</head>
<style>
 #obj{
   width:100px;
   height:100px;
   background-color:yellowgreen;
   position:absolute
 }
 #s{
   background-color:rebeccapurple;
   position: relative;
   width:50px;
   height:100px;
 }
</style>
<script>
  window.onload=function(){
     document.onkeydown=function(event){
       console.log(event.keyCode);
       if(event.keyCode===89 && event.ctrlKey){
         console.log("ctrl和y同时按下");//ctrlkey,shiftkey,altKey
       }
     };
     var input=document.getElementById("input");
     input.onkeydown=function(){
       console.log("按键被按下了");
       console.log(event.keyCode);
     }
 }
 </script>
<body>
  <input type="text" id="input">
  <div id="obj"></div>
</body>
</html>                                                                                                                                 